//---------------------------------------------------------------------
//  This file is part of the Background Motion solution.
// 
//  Copyright (C) Mindscape (TM).  All rights reserved.
//  http://www.mindscape.co.nz
// 
//  THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//  PARTICULAR PURPOSE.
//---------------------------------------------------------------------

using Microsoft.Practices.EnterpriseLibrary.Validation;
using Mindscape.BackgroundMotion.Model;
using Mindscape.BackgroundMotion.Website.Controllers;
using Mindscape.BackgroundMotion.Website.Infrastructure;
using Mindscape.BackgroundMotion.Website.Views;

namespace Mindscape.BackgroundMotion.Website
{
  public partial class Signup : PageBase<SignupPresenter, ISignupView, IMembershipController>, ISignupView
  {
    private Member _currentMember;

    /// <summary>
    /// Handles the Click event of the SignupButton control by saving the new member
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void SignupButton_Click(object sender, System.EventArgs e)
    {
      DataBinder.Unbind();
      Presenter.Save();
    }

    /// <summary>
    /// A list of validation results to be shown in error if there are data entry errors on the contribution
    /// </summary>
    public ValidationResults ValidationResults
    {
      set
      {
        ErrorsRepeater.DataSource = value;
        ErrorsRepeater.DataBind();
      }
    }

    /// <summary>
    /// Represents the member currently being created on the form
    /// </summary>
    public Member CurrentMember
    {
      get { return _currentMember; }
      set { _currentMember = value; }
    }
  }
}